<template>
    <div class="p-2">
        <el-card shadow="never">
            <template #header>
                <el-form :model="queryParams" ref="queryFormRef" :inline="true">
                    <el-form-item label="制单日期：" prop="timeDate">
                        <el-date-picker v-model="queryParams.timeDate" type="daterange" range-separator="至"
                            start-placeholder="开始时间" end-placeholder="结束时间" @change="handleTimeChange"
                            format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
                    </el-form-item>
                    <el-form-item label="加工费审批：" prop="orderPrintStatus">
                        <el-select style="width: 120px;" v-model="queryParams.orderPrintStatus" clearable>
                            <el-option label="未打印" value="0"></el-option>
                            <el-option label="已打印" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="半成品名称：" prop="orderPrintStatus">
                        <el-input v-model="queryParams.workName" placeholder="请输入"></el-input>
                    </el-form-item>

                    <el-form-item>
                        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
                        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
                    </el-form-item>
                </el-form>
            </template>
            <el-table v-loading="loading" :data="dataList" stripe>
                <el-table-column label="制单日期" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="交货日期" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="生产单号" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="半成品名称" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="投放数量" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="完成数量" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="延期入库时间" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="加工费审批" prop="customizedName" align="center"></el-table-column>
                <el-table-column label="操作" align="center">
                    <template #default="scope">
                        <el-tooltip content="审批">
                            <el-button link type="warning">
                                <i style="font-size: 18px;" class="iconfont icon-daifukuan"></i>
                            </el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
            <pagination v-show="totalData > 0" :total="totalData" v-model:page="queryParams.pageNum"
                v-model:limit="queryParams.pageSize" @pagination="getList" />
        </el-card>

    </div>
</template>
<script setup lang="ts">
import { type FormInstance } from 'element-plus';



const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const queryFormRef = ref<FormInstance>();

const data = reactive<pageDataOnlyQuery<any>>({
    queryParams: {
        timeDate: '',
        startDate: '',
        endDate: '',
        pageSize: 10,
        pageNum: 1
    }
});

const { queryParams } = toRefs(data);

const loading = ref(false);
const dataList = ref<any>([]);
const totalData = ref(0);
const voucherVisible = ref(false);

const handleQuery = () => {
    queryParams.value.pageNum = 1;
    getList();
};

const resetQuery = () => {
    queryFormRef.value?.resetFields();
    queryParams.value.startDate = '';
    queryParams.value.endDate = '';
    queryParams.value.timeDate = '';
    handleQuery();
};

/** 日期选择 */
const handleTimeChange = (val: any) => {
    queryParams.value.startDate = val[0];
    queryParams.value.endDate = val[1];
};

const getList = async () => {
    dataList.value = [
        {
            id: 1,
            customizedName: '中国',
            updateTime: '2022-01-01',
            updateByName: '张三',
            updateBy: '1'
        },
        {
            id: 2,
            customizedName: '中国',
            updateTime: '2022-01-01',
            updateByName: '张三',
        }
    ];
};

onMounted(() => {
    getList();
});

</script>
<style lang="scss" scoped></style>